package com.ruoyi.web.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.mapper.ExecutionRecordMapper;
import com.ruoyi.web.domain.ExecutionRecord;
import com.ruoyi.web.service.IExecutionRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * recordService业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-19
 */
@Service
public class ExecutionRecordServiceImpl implements IExecutionRecordService 
{
    @Autowired
    private ExecutionRecordMapper executionRecordMapper;

    /**
     * 查询record
     * 
     * @param id record主键
     * @return record
     */
    @Override
    public ExecutionRecord selectExecutionRecordById(Long id)
    {
        return executionRecordMapper.selectExecutionRecordById(id);
    }

    /**
     * 查询record列表
     * 
     * @param executionRecord record
     * @return record
     */
    @Override
    public List<ExecutionRecord> selectExecutionRecordList(ExecutionRecord executionRecord)
    {
        return executionRecordMapper.selectExecutionRecordList(executionRecord);
    }

    /**
     * 新增record
     * 
     * @param executionRecord record
     * @return 结果
     */
    @Override
    public int insertExecutionRecord(ExecutionRecord executionRecord)
    {
        executionRecord.setCreateTime(DateUtils.getNowDate());
        executionRecord.setCreateBy(ShiroUtils.getSysUser().getLoginName());
        executionRecord.setName(ShiroUtils.getSysUser().getLoginName());
        return executionRecordMapper.insertExecutionRecord(executionRecord);
    }

    /**
     * 修改record
     * 
     * @param executionRecord record
     * @return 结果
     */
    @Override
    public int updateExecutionRecord(ExecutionRecord executionRecord)
    {
        executionRecord.setUpdateTime(DateUtils.getNowDate());
        return executionRecordMapper.updateExecutionRecord(executionRecord);
    }

    /**
     * 批量删除record
     * 
     * @param ids 需要删除的record主键
     * @return 结果
     */
    @Override
    public int deleteExecutionRecordByIds(String ids)
    {
        return executionRecordMapper.deleteExecutionRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除record信息
     * 
     * @param id record主键
     * @return 结果
     */
    @Override
    public int deleteExecutionRecordById(Long id)
    {
        return executionRecordMapper.deleteExecutionRecordById(id);
    }
}
